﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Configuration;
using System.Data.OleDb;

/// <summary>
/// Summary description for Hotel_service
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Hotel_service : System.Web.Services.WebService {

    public Hotel_service () {

        //Uncomment the following line if using designed components 
        //InitializeComponent(); 
    }

    [WebMethod]
    public string Cena_KUpuvanje(int cenaK) 
    {
        string conString = ConfigurationManager.ConnectionStrings["link"].ConnectionString;
        OleDbConnection conn = new OleDbConnection(conString);

        conn.Open();
        string select = "SELECT cena_za_kupuvanje FROM Hoteli WHERE Id_Grad = ?";
        OleDbCommand cmd = new OleDbCommand(select, conn);
        cmd.Parameters.AddWithValue("?", cenaK);

        OleDbDataReader r = cmd.ExecuteReader();
        r.Read();

        return r.ToString();
        
    }
    [WebMethod]
    public string Cena_Poseta(int cenaP)
    {
        string conString = ConfigurationManager.ConnectionStrings["link"].ConnectionString;
        OleDbConnection conn = new OleDbConnection(conString);

        conn.Open();
        string select = "SELECT cena_za_posta FROM Hoteli WHERE Id_Grad = ?";
        OleDbCommand cmd = new OleDbCommand(select, conn);
        cmd.Parameters.AddWithValue("?", cenaP);

        OleDbDataReader r = cmd.ExecuteReader();
        r.Read();

        return r.ToString();

    }
    
}
